﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.IO;
using System.Xml.Linq;

namespace Springbok.Service
{
    [ServiceContract]
    public interface IWMS
    {
        [WebGet(UriTemplate = "wms/{value}")]
        [OperationContract]
        string GetData(string value);

        [WebGet(UriTemplate = "{mapname}/wms?LAYERS={layers}&STYLES=&FORMAT={imageformat}&SERVICE=WMS&VERSION={version}&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS={srs}&BBOX={bbox}&WIDTH={width}&HEIGHT={height}")]
        [OperationContract]
        Stream GetMap(string mapname, string layers, string imageformat, string version,string srs,string bbox,string width,string height);  // /geoserver/nurc/wms?LAYERS=nurc%3AArc_Sample&STYLES=&FORMAT=image%2Fjpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-232.03125,-116.015625,232.03125,116.015625&WIDTH=660&HEIGHT=330 

        // /WMSService.svc/nurc/wms?REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml&BBOX=-232.03125%2C-116.015625%2C232.03125%2C116.015625&SERVICE=WMS&VERSION=1.1.1&X=117&Y=154&INFO_FORMAT=text%2Fhtml&QUERY_LAYERS=nurc%3AArc_Sample&FEATURE_COUNT=50&Layers=nurc%3AArc_Sample&WIDTH=660&HEIGHT=330&format=image%2Fjpeg&styles=&srs=EPSG%3A4326
        [WebGet(UriTemplate = "{mapname}/wms?REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml&BBOX={bbox}&SERVICE=WMS&VERSION={version}&X={x}&Y={y}&INFO_FORMAT={infoformat}&QUERY_LAYERS={qlayers}&FEATURE_COUNT={featurecount}&Layers={layers}&WIDTH={width}&HEIGHT={height}&format={imageformat}&styles=&srs={srs}")]
        [OperationContract]
        XElement GetFeatureInfo(string mapname, string qlayers, string layers, string infoformat, string imageformat, string featurecount, string version, string srs, string bbox, string width, string height, string x, string y);  // /geoserver/nurc/wms?LAYERS=nurc%3AArc_Sample&STYLES=&FORMAT=image%2Fjpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-232.03125,-116.015625,232.03125,116.015625&WIDTH=660&HEIGHT=330 

        /*
        //http://localhost:8080/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=topp:states&SLD=http://localhost:8080/geoserver/www/styles/green.sld
        [WebGet(UriTemplate = "{mapname}/wms?REQUEST=GetLegendGraphic&VERSION={version}&FORMAT={imageformat}&WIDTH={width}&HEIGHT={height}&LAYER={layer}&SLD={sldurl}")]
        [OperationContract]
        String GetLegendGraphicSLD(string mapname, string version, string imageformat, string width, string height, string layer, string sldurl);
       */
        
        /*
        //http://localhost:8080/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=topp:states&SLD_BODY=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22ISO-8859-1%22%3F%3E%3CStyledLayerDescriptor+version%3D%221.0.0%22+xsi%3AschemaLocation%3D%22http%3A%2F%2Fwww.opengis.net%2Fsld+StyledLayerDescriptor.xsd%22+xmlns%3D%22http%3A%2F%2Fwww.opengis.net%2Fsld%22+xmlns%3Aogc%3D%22http%3A%2F%2Fwww.opengis.net%2Fogc%22+xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22+xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22%3E%3CNamedLayer%3E%3CName%3EATestLayer%3C%2FName%3E%3CUserStyle%3E%3CName%3Epolyshp%3C%2FName%3E%3CFeatureTypeStyle%3E%3CRule%3E%3CPolygonSymbolizer%3E%3CFill%3E%3CCssParameter%20name%3D%22fill%22%3E%2366FF66%3C%2FCssParameter%3E%3C%2FFill%3E%3CStroke%2F%3E%3C%2FPolygonSymbolizer%3E%3C%2FRule%3E%3C%2FFeatureTypeStyle%3E%3C%2FUserStyle%3E%3C%2FNamedLayer%3E%3C%2FStyledLayerDescriptor%3E&
        [WebGet(UriTemplate = "{mapname}/wms?REQUEST=GetLegendGraphic&VERSION={version}&FORMAT={imageformat}&WIDTH={width}&HEIGHT={height}&LAYER={layer}&SLD_BODY={sldbody}")]
        [OperationContract]
        String GetLegendGraphicSLDBody(string mapname, string version, string imageformat, string width, string height, string layer, string sldbody);
        */
        /*
        //http://localhost:8080/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=topp:states
        [WebGet(UriTemplate = "{mapname}/wms?REQUEST=GetLegendGraphic&VERSION={version}&FORMAT={imageformat}&WIDTH={width}&HEIGHT={height}&LAYER={layer}")]
        [OperationContract]
        String GetLegendGraphic(string mapname, string version, string imageformat, string width, string height, string layer);
        */
        /*
        //http://localhost:8080/geoserver/wms?request=DescribeLayer&version=1.1.1&layers=topp:states
        [WebGet(UriTemplate = "{mapname}/wms?request=DescribeLayer&version={version}&layers={layers}")]
        [OperationContract]
        String WMSDescribeLayer(string mapname, string version, string layers);
        */
        /*
        //http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&styles=population&format=jpeg&info_format=text/plain&request=GetFeatureInfo&layers=topp:states&query_layers=topp:states&width=550&height=250&x=170&y=160
        [WebGet(UriTemplate = "{mapname}/wms?bbox={bbox}&styles={styles}&format={imageformat}&info_format={infoformat}&request=GetFeatureInfo&layers={layers}&query_layers={qlayers}&width={width}&height={height}&x={x}&y={y}")]
        [OperationContract]
        String WMSFeatureinfo(string mapname,string bbox,string styles, string imageformat, string infoformat, string layers,string qlayers,string width, string height, string x,string y);
        */
        /*
        //http://localhost:8080/geoserver/wms?request=getCapabilities
        [WebInvoke(Method="POST",UriTemplate = "{mapname}/wms?REQUEST=getCapabilities")]
        [OperationContract]
        String WMSGetCapabilities(string mapname, string bodystream);
        */
        /*
        //http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&styles=population&Format=application/openlayers&request=GetMap&layers=topp:states&width=550&height=250&srs=EPSG:4326
        [WebGet(UriTemplate = "{mapname}/wms?bbox={bbox}&styles={styles}&Format=application/openlayers&request=GetMap&layers={layers}&width={width}&height={height}&srs={srid}")]
        [OperationContract]
        String WMSGetMapOpenlayer(string mapname, string bbox, string styles, string layers, string width, string height, string srid);
        */
        /*
        //http://localhost:8080/geoserver/wms?version=1.3.0&bbox=24,-130,50,-66&Format=image/png&request=GetMap&width=550&height=250&crs=EPSG:4326&SLD_BODY=%3CStyledLayerDescriptor+version%3D%221.1.0%22%3E%3CUserLayer%3E%3CName%3Etopp%3Astates%3C%2FName%3E%3CUserStyle%3E%3CName%3EUserSelection%3C%2FName%3E%3CFeatureTypeStyle%3E%3CRule%3E%3CFilter%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3ESTATE_NAME%3C%2FPropertyName%3E%3CLiteral%3EIllinois%3C%2FLiteral%3E%3C%2FPropertyIsEqualTo%3E%3C%2FFilter%3E%3CPolygonSymbolizer%3E%3CFill%3E%3CSvgParameter+name%3D%22fill%22%3E%23FF0000%3C%2FSvgParameter%3E%3C%2FFill%3E%3C%2FPolygonSymbolizer%3E%3C%2FRule%3E%3CRule%3E%3CLineSymbolizer%3E%3CStroke%2F%3E%3C%2FLineSymbolizer%3E%3C%2FRule%3E%3C%2FFeatureTypeStyle%3E%3C%2FUserStyle%3E%3C%2FUserLayer%3E%3C%2FStyledLayerDescriptor%3E
        [WebGet(UriTemplate = "{mapname}/wms?wms?version=1.3.0&bbox={bbox}&Format={imageformat}&request=GetMap&width={width}&height={height}&crs={srid}&SLD_BODY={sldbody}")]
        [OperationContract]
        String WMSGetMapSLDBodyLiteralmode13(string mapname, string bbox, string imageformat,string width, string height, string srid, string sldbody);
        */
        /*
        //http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&Format=image/png&request=GetMap&width=550&height=250&srs=EPSG:4326&SLD_BODY=%3CStyledLayerDescriptor%20version%3D%221.0.0%22%3E%3CUserLayer%3E%3CName%3Etopp:states%3C/Name%3E%3CUserStyle%3E%3CName%3EUserSelection%3C/Name%3E%3CFeatureTypeStyle%3E%3CRule%3E%3CFilter%20xmlns:gml%3D%22http://www.opengis.net/gml%22%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3ESTATE_NAME%3C/PropertyName%3E%3CLiteral%3EIllinois%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/Filter%3E%3CPolygonSymbolizer%3E%3CFill%3E%3CCssParameter%20name%3D%22fill%22%3E%23FF0000%3C/CssParameter%3E%3C/Fill%3E%3C/PolygonSymbolizer%3E%3C/Rule%3E%3CRule%3E%3CLineSymbolizer%3E%3CStroke/%3E%3C/LineSymbolizer%3E%3C/Rule%3E%3C/FeatureTypeStyle%3E%3C/UserStyle%3E%3C/UserLayer%3E%3C/StyledLayerDescriptor%3E
        [WebGet(UriTemplate = "{mapname}/wms?bbox={bbox}&Format={imageformat}&request=GetMap&width={width}&height={height}&srs={srid}&SLD_BODY={sldbody}")]
        [OperationContract]
        String WMSGetMapSLDBodyLiteralmode(string mapname, string bbox, string imageformat, string width, string height, string srid, string sldbody);
        /*
        //http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&request=GetMap&layers=topp:states&width=800&height=400&srs=EPSG:4326&styles=population&Format=image/svg+xml
        [WebGet(UriTemplate = "{mapname}/wms?bbox={bbox}&request=GetMap&layers={layers}&width={width}&height={height}&srs={srid}&styles={styles}&Format=image/svg+xml")]
        [OperationContract]
        String WMSGetMapSVG(string mapname, string version, string imageformat, string width, string height, string layer, string sldurl);
        */
         /*
        //http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&styles=burg&Format=image/png&request=GetMap&layers=tiger:poi&width=550&height=250&srs=EPSG:4326
        [WebGet(UriTemplate = "{mapname}/wms?bbox={bbox}&styles={styles}&Format={imageformat}&request=GetMap&layers={layers}&width={width}&height={height}&srs={srid}")]
        [OperationContract]
        String WMSGetMapSVGStyle(string mapname, string bbox,string styles, string imageformat, string layers, string width, string height, string srid);
        */
        /*
        //http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&styles=population&Format=image/png&request=GetMap&layers=topp:states&width=550&height=250&srs=EPSG:4326&featureid=states.1
        [WebGet(UriTemplate = "{mapname}/wms?bbox={bbox}&styles={styles}&Format={imageformat}&request=GetMap&layers={layers}&width={width}&height={height}&srs={srid}&featureid={fid}")]
        [OperationContract]
        String WMSGetMapFid(string mapname, string version, string imageformat, string width, string height, string layer, string sldurl);
         */
        /*
        //http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&styles=population&Format=image/png&request=GetMap&layers=topp:states&width=550&height=250&srs=EPSG:4326&filter=%3CFilter%20xmlns=%22http://www.opengis.net/ogc%22%3E%3CFeatureId%20fid=%22states.1%22/%3E%3C/Filter%3E
        [WebGet(UriTemplate = "{mapname}/wms?bbox={bbox}&styles={styles}&Format={imageformat}&request=GetMap&layers={layers}&width={width}&height={height}&srs={srid}&filter={filter}")]
        [OperationContract]
        String WMSGetMapFidFilter(string mapname,string bbox, string styles, string imageformat,string layers, string width, string height,string srid,string filter);
         */
        /*
        //http://localhost:8080/geoserver/wms?validateSchema=true&FORMAT=image/png&TRANSPARENT=TRUE&HEIGHT=406&WIDTH=810&REQUEST=GetMap&SRS=EPSG:4326&VERSION=1.1.1&BBOX=-120,-120,120,120&SLD_BODY=%3C?xml%20version=%221.0%22%20encoding=%22UTF-8%22?%3E%3CStyledLayerDescriptor%20version=%221.0.0%22%20xmlns:gml=%22http://www.opengis.net/gml%22%20xmlns:ogc=%22http://www.opengis.net/ogc%22%20xmlns=%22http://www.opengis.net/sld%22%3E%3CUserLayer%3E%3CName%3Ejunk%3C/Name%3E%3CInlineFeature%3E%3CFeatureCollection%3E%3CfeatureMember%3E%3CBodyPart%3E%3CType%3EFace%3C/Type%3E%3CpolygonProperty%3E%3Cgml:Polygon%3E%3Cgml:outerBoundaryIs%3E%3Cgml:LinearRing%3E%3Cgml:coordinates%3E-10,10%2010,10%2010,-10%20-10,-10%20-10,10%3C/gml:coordinates%3E%3C/gml:LinearRing%3E%3C/gml:outerBoundaryIs%3E%3C/gml:Polygon%3E%3C/polygonProperty%3E%3C/BodyPart%3E%3C/featureMember%3E%3C/FeatureCollection%3E%3C/InlineFeature%3E%3CLayerFeatureConstraints%3E%3CFeatureTypeConstraint%3E%3C/FeatureTypeConstraint%3E%3C/LayerFeatureConstraints%3E%3CUserStyle%3E%3CFeatureTypeStyle%3E%3CRule%3E%3CPolygonSymbolizer%3E%3CFill%3E%3CCssParameter%20name=%22fill%22%3E%3Cogc:Literal%3E%23F00620%3C/ogc:Literal%3E%3C/CssParameter%3E%3CCssParameter%20name=%22fill-opacity%22%3E%3Cogc:Literal%3E1.0%3C/ogc:Literal%3E%3C/CssParameter%3E%3C/Fill%3E%3CStroke%3E%3CCssParameter%20name=%22stroke%22%3E%3Cogc:Literal%3E%23FF0000%3C/ogc:Literal%3E%3C/CssParameter%3E%3C/Stroke%3E%3C/PolygonSymbolizer%3E%3C/Rule%3E%3C/FeatureTypeStyle%3E%3C/UserStyle%3E%3C/UserLayer%3E%3C/StyledLayerDescriptor%3E
        [WebGet(UriTemplate = "{mapname}/wms?validateSchema={isvalidateschema}&FORMAT={imageformat}&TRANSPARENT={istransparent}&HEIGHT={height}&WIDTH={width}&REQUEST=GetMap&SRS={srid}&VERSION={version}&BBOX={bbox}&SLD_BODY={sldbody}")]
        [OperationContract]
        String WMSGetMapInlineFeature(string mapname, string isvalidateschema, string imageformat, string istransparent, string width, string height,string srid, string version, string bbox, string sldbody);
        /*
        //http://localhost:8080/geoserver/wms
        [WebInvoke(Method="POST",UriTemplate = "{mapname}/wms")]
        [OperationContract]
        String WMSGetMapInlineFeatureSmile(string mapname, Stream bodyxml);
         */
        /*
        //http://localhost:8080/geoserver/wms?request=GetMap&layers=tiger:poly_landmarks,tiger:tiger_roads&styles=,&bbox=-74.05,40.68,-73.91,40.88&Format=image/png&width=344&height=500&srs=EPSG:4326
        [WebGet(UriTemplate = "{mapname}/wms?request=GetMap&layers={layers}&styles={styles}&bbox={bbox}&Format={imageformat}&width={width}&height={height}&srs={srid}")]
        [OperationContract]
        String WMSGetMapmultilayer(string mapname,string layers,string styles, string bbox, string imageformat,string width, string height, string srid);
        */
        /*
        //http://localhost:8080/geoserver/wms?request=GetMap&layers=tiger:poly_landmarks,tiger:tiger_roads&styles=,&bbox=-73.97,40.74,-73.93,40.78&Format=image/png&width=344&height=500&srs=EPSG:4326&cql_Filter=LANAME%20=%20%27East%20River%27;NAME%20=%20%27West%20Rd%27
        [WebGet(UriTemplate = "{mapname}/wms?request=GetMap&layers={layers}&styles={styles}&bbox={bbox}&Format={imageformat}&width={width}&height={height}&srs={srid}&cql_Filter={cqlfileter}")]
        [OperationContract]
        String WMSGetMapMultilayerCql(string mapname, string layers, string styles, string bbox, string imageformat, string width, string height, string srid, string cqlfilter);
         */
        /*
        //http://localhost:8080/geoserver/wms?request=GetMap&layers=tiger:poly_landmarks,tiger:tiger_roads&styles=,&bbox=-73.97,40.74,-73.93,40.78&Format=image/png&width=344&height=500&srs=EPSG:4326&filter=(%3CFilter%20xmlns=%22http://www.opengis.net/ogc%22%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3ELANAME%3C/PropertyName%3E%3CLiteral%3EEast%20River%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/Filter%3E)(%3CFilter%20xmlns=%22http://www.opengis.net/ogc%22%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3ENAME%3C/PropertyName%3E%3CLiteral%3EWest%20Rd%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/Filter%3E)
        [WebGet(UriTemplate = "{mapname}/wms?request=GetMap&layers={layers}&styles={styles}&bbox={bbox}&Format={imageformat}&width={width}&height={height}&srs={srid}&filter={filter}")]
        [OperationContract]
        String WMSGetMapMultilayerFilter(string mapname, string layers, string styles, string bbox,string imageformat, string width, string height,string srid, string filter);
         * */
    }
}
